UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eS//ZSbiF9Qm/Rym3qDsvZ7lNIdFZ6oUGUBAxEHeEac=' 
WHERE 
  key_id = 'bfe5c42e40a99b0669928e6a2b3c25f03e21476da5306434039cf2aa5ee87654' 
  AND (
    token = 'eS//ZSbiF9Qm/Rym3qDsvZ7lNIdFZ6oUGUBAxEHeEac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038