UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TCDfoPokvQMiCCEcG3RWrNKXT14eZvNYWVUOl29pUdQ=' 
WHERE 
  key_id = 'cd64af5c41cab8663bafbdf6357ba897bdbcf50e4fd80e11c36663f086a61960' 
  AND (
    token = 'TCDfoPokvQMiCCEcG3RWrNKXT14eZvNYWVUOl29pUdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040