UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uyRuenVLLKB/B8hOGEVX+9irMv+dKFf58vRBNMuLJiQ=' 
WHERE 
  key_id = '9c32a38c6169b39e282c4d2c526f886c8ced6858f277092ddc959eb590c1f205' 
  AND (
    token = 'uyRuenVLLKB/B8hOGEVX+9irMv+dKFf58vRBNMuLJiQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029