UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TxA8cwdaqEeS63fkaTMHttlWByqnCaUEQxPrpB/tCV4=' 
WHERE 
  key_id = '8ca076a060e800e93c04b8b6b879800e3cae4e1803eae58f4f433b9bdadb85fe' 
  AND (
    token = 'TxA8cwdaqEeS63fkaTMHttlWByqnCaUEQxPrpB/tCV4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038