UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XBsWtojpiFwpvagKKfuDnXub2X5tWs39OF+1HxsNVNA=' 
WHERE 
  key_id = 'd953bf449605e432adf9ea92d1a7386c89252d43afe9644efed1ed1d68d00de5' 
  AND (
    token = 'XBsWtojpiFwpvagKKfuDnXub2X5tWs39OF+1HxsNVNA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032