UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DCYNy6SDGuHt0OSvpSNkFzTVF52ZndX/zUAKBxMymPU=' 
WHERE 
  key_id = '25f42c453b61a274de0fbbffff86e9a25ea8394c667ffdca013b1595d9704f0e' 
  AND (
    token = 'DCYNy6SDGuHt0OSvpSNkFzTVF52ZndX/zUAKBxMymPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032