UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WQcSysjY2WAtiK35mvdsORqkruRr6MjJ6XbkIjW/aeE=' 
WHERE 
  key_id = '72edf388831e320917e11239fab394714a3bf645676431e5f20e678d7062ae56' 
  AND (
    token = 'WQcSysjY2WAtiK35mvdsORqkruRr6MjJ6XbkIjW/aeE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040