UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w3jepvTEWILthy3JCdSffgittdGr1sYZ8yUMn9dQLLE=' 
WHERE 
  key_id = '6f0345e88b84292be855411cd6759da060ce779995f2d69c3d8997495a6331cc' 
  AND (
    token = 'w3jepvTEWILthy3JCdSffgittdGr1sYZ8yUMn9dQLLE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037