UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uRN6yd62rPJGtrfzeRWAZsPDBN6OMNVK4KSKv+63OQ4=' 
WHERE 
  key_id = 'db96d338b60c08bd2d921992af2d1966a9cc479bfd992c8d228e15ad338f07ad' 
  AND (
    token = 'uRN6yd62rPJGtrfzeRWAZsPDBN6OMNVK4KSKv+63OQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068