UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UG3GSiPya8fEV7EXZ/8lRK1Rl+PSbEraMDBHs0J4dUM=' 
WHERE 
  key_id = '213b4907d8bd924319a7613413f98449ed092518688f2b2de623ff3df6f75897' 
  AND (
    token = 'UG3GSiPya8fEV7EXZ/8lRK1Rl+PSbEraMDBHs0J4dUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045