UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c8FVR9oNx28s5am01y0HHHjvc6FDHcSj4KsUJtv/Mh8=' 
WHERE 
  key_id = '71efa06cc6aec9602eb435a350f9a84727b4f8cd0c0d4cd5ef08e8507f09865f' 
  AND (
    token = 'c8FVR9oNx28s5am01y0HHHjvc6FDHcSj4KsUJtv/Mh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034