UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u8AoKBqI21BQIu8hsw+5Yp231uEG/czqE6911wR2Vjw=' 
WHERE 
  key_id = '6a21e6e9040ec8a9ccd25fc9fd4f6e9b6ac25fa18e1f519ca80497c052bac7c4' 
  AND (
    token = 'u8AoKBqI21BQIu8hsw+5Yp231uEG/czqE6911wR2Vjw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038