UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i7Rs9UjbpF+rT8rBZugjz4i1lS9p+FDs5kGiQHv1u34=' 
WHERE 
  key_id = 'ed250d863369425b831e46fe8b83e9a598ab711522a7ae78461b5afe85a47896' 
  AND (
    token = 'i7Rs9UjbpF+rT8rBZugjz4i1lS9p+FDs5kGiQHv1u34=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033