UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LYtgDV7aezhZ+37MtdqhY6pExVEBoYUAADmZr/tLPrg=' 
WHERE 
  key_id = '88e3aabc96272df2aec60852d7605e36f31f51009d6b66075e560cf6b677b765' 
  AND (
    token = 'LYtgDV7aezhZ+37MtdqhY6pExVEBoYUAADmZr/tLPrg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026