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

Query time 0.00060