UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ic85XXUgZv1dX2ilICTH0w5KbZm4ph8XFf+msOXKQ80=' 
WHERE 
  key_id = '0f648fd832927fd0e2ca37d717e4dbabb783fb05691e62dddd155c86043b67b4' 
  AND (
    token = 'Ic85XXUgZv1dX2ilICTH0w5KbZm4ph8XFf+msOXKQ80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043