UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5PbouFqiTsEdBWJvo28W3KZQgLzz28Qy29dqyihVF/8=' 
WHERE 
  key_id = '80e2f204b2f58d82b83a83dca626f3e24b3697afbdde00d39dab03812f1164ff' 
  AND (
    token = '5PbouFqiTsEdBWJvo28W3KZQgLzz28Qy29dqyihVF/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027