UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w8fhE+fOQZjQRhTstu6mIfoBjR7VfSzfcp+QlviRSFQ=' 
WHERE 
  key_id = '040bf4cb26864293800bc6fca4db4f8121a2357978f34c98c8cfdcbde11cde4b' 
  AND (
    token = 'w8fhE+fOQZjQRhTstu6mIfoBjR7VfSzfcp+QlviRSFQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027