UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gl6+H53icWFBSLiZWcO1MV/9RqBnahWsPWFrh2yywUU=' 
WHERE 
  key_id = '2a69944578841257323dac92008a97ac5a6bca87708c01aece66b4636bdc6793' 
  AND (
    token = 'gl6+H53icWFBSLiZWcO1MV/9RqBnahWsPWFrh2yywUU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047