UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j2v2Fl6mq0v/nLAWv/lvtTwE8Ixy2TAGjpOlNUCkwKg=' 
WHERE 
  key_id = '1772f00c770abdce6479a49652638841d7e76974c5a2f7c2506120886a72093e' 
  AND (
    token = 'j2v2Fl6mq0v/nLAWv/lvtTwE8Ixy2TAGjpOlNUCkwKg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030