UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CcxevCnj+hSqexBHW4G+jlY27mFwyU3+JaMSazWgOGM=' 
WHERE 
  key_id = 'c87582bb19ac3f57f70c39b58c07f58d3e44bad7755c3d5df6e67eee74af8a2e' 
  AND (
    token = 'CcxevCnj+hSqexBHW4G+jlY27mFwyU3+JaMSazWgOGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035