UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NmlVDTiVoqqy2NU+kOW2jHOgVJpqj24AOvuAD6IhbIY=' 
WHERE 
  key_id = '19d58823bbc9ac1fe1562817010e5547b10e4fe5d78779208181f680977ceb21' 
  AND (
    token = 'NmlVDTiVoqqy2NU+kOW2jHOgVJpqj24AOvuAD6IhbIY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044