UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x1l6+9w3FsljIG8afdbZRrm2aC6paLV/bN4TNfzxZoo=' 
WHERE 
  key_id = '2bbbe2a8b63dd578595979777c4992621dea8c34b8d1e73a384941ec5d90ea44' 
  AND (
    token = 'x1l6+9w3FsljIG8afdbZRrm2aC6paLV/bN4TNfzxZoo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026