UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F/u6PzhzhXEa09zneU31OA3sn0+GzUox+mHYjYtkSnU=' 
WHERE 
  key_id = '9ac4495a016f80095fac378d1a2e404c21581c4e35b8fe51b85747304b66c3b7' 
  AND (
    token = 'F/u6PzhzhXEa09zneU31OA3sn0+GzUox+mHYjYtkSnU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028