UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kGXZr7mAWgwQJFab86cN9/r2S46BR538BaWJFyzx46U=' 
WHERE 
  key_id = 'a212f71433ec4589cd44164b7cd1007bed25b38a54540cd684c11aaf4d31e689' 
  AND (
    token = 'kGXZr7mAWgwQJFab86cN9/r2S46BR538BaWJFyzx46U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055