UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+qU5DkWb3RmFgbgArEbmKVPtFYZkIUj0OSU+tQdyxv4=' 
WHERE 
  key_id = '817d1fb0e289644aa85dff2456d5e53a18bae0b30a5d75919c657fe343f930d2' 
  AND (
    token = '+qU5DkWb3RmFgbgArEbmKVPtFYZkIUj0OSU+tQdyxv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047