UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lf2cUpqrLK5S2T4c14b8jIyZKUidj2CC+A/wSaAmvLc=' 
WHERE 
  key_id = 'e63d8d3022d49296bd9a94082f781bdbd7d9da4629c38dfa0647de1e2e4aec6a' 
  AND (
    token = 'lf2cUpqrLK5S2T4c14b8jIyZKUidj2CC+A/wSaAmvLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037