UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qel1ga2Li29OyJsSC041CCGmKCTcnk+BEGV5PANqzo0=' 
WHERE 
  key_id = '47d2b9ab1b925673afdb61e729fce52d0ec9ac9a77034db904dafec89ff59cdd' 
  AND (
    token = 'qel1ga2Li29OyJsSC041CCGmKCTcnk+BEGV5PANqzo0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020